def test_path_exists(self): cfg = json.dumps({"token": "foo", "team": "bar"}) config_file = StringIO(cfg.encode('utf8').decode()) path = mock.MagicMock() path.open.return_value.__enter__.return_value = config_file config = idonethis.read_config(path) self.assertEqual({'token': 'foo', 'team': 'bar'}, config)
def test_reading_config_fails(self): config = idonethis.read_config(None) self.assertEqual(config, {})