Skip to content

Instantly share code, notes, and snippets.

View colinfwren's full-sized avatar

Colin Wren colinfwren

View GitHub Profile
{
'0': {
numFailedTestSuites: 0,
numFailedTests: 0,
numPassedTestSuites: 0,
numPassedTests: 0,
numPendingTestSuites: 0,
numPendingTests: 0,
numRuntimeErrorTestSuites: 0,
numTodoTests: 0,
{
'0': {
context: {
config: {
automock: false,
browser: false,
cache: true,
cacheDirectory: '/private/var/folders/_x/_49pjjwx42b4t1j9v9vjv4yh0000gn/T/jest_dx',
clearMocks: false,
coveragePathIgnorePatterns: [
{
'0': {},
'1': {
numFailedTestSuites: 0,
numFailedTests: 0,
numPassedTestSuites: 15,
numPassedTests: 46,
numPendingTestSuites: 0,
numPendingTests: 0,
numRuntimeErrorTestSuites: 0,
@colinfwren
colinfwren / cd_with_travis.yml
Last active April 8, 2019 20:15
Using Travis for CD
addons:
sonarcloud:
organization: $SONARQUBE_ORG_NAME
token:
secure: $SONARQUBE_TOKEN
services:
- docker
language: python
python:
- 3.6
@colinfwren
colinfwren / vague_assertion.js
Created April 26, 2019 20:18
Example of a unit test with vague assertion
import Foo from 'module';
const bar = (foo) => {
if (typeof (foo) === 'undefined') {
throw new Error('Foo needs to be defined stupid!');
}
return new Foo(foo);
}
describe('bar', () => {
import pytest
import subprocess
import os
import testinfra
DOCKER_IMAGE_NAME = 'gimpneek/snapdex'
# scope='session' uses the same container for all the tests;
# scope='function' uses a new container per test function.
@pytest.fixture(scope='class')
from unittest import TestCase
import pytest
@pytest.mark.usefixtures("host")
class TestRequirements(TestCase):
"""
Check the requirements for running the bot are set up in the Docker image
correctly
"""
dist: xenial
services:
- docker
language: python
python:
- 3.7
install:
- make install_bot_deps
script:
- make ci_test
import pyhue
HUE_IP = 'XXX.XXX.XXX.XXX'
HUE_USERNAME = 'replace_with_username'
HUE_ROOMS = ['Office']
# Get the pyhue.Bridge instance
bridge = pyhue.Bridge(HUE_IP, HUE_USERNAME)
# Find the room in the list of rooms set up by the user
import pyhue
HUE_IP = 'XXX.XXX.XXX.XXX'
HUE_USERNAME = 'replace_with_username'
HUE_ROOMS = ['Office']
# Get the pyhue.Bridge instance
bridge = pyhue.Bridge(HUE_IP, HUE_USERNAME)
# Find the room in the list of rooms set up by the user