def test_get_context_variables(self): state = State() state.update_context_variables({'PROJECT_NAME': 'foo'}) self.assertEqual(state.get_context_variables(), { 'PROJECT_NAME': 'foo'})
def test_get_context_variable(self): state = State() state.update_context_variables({'PROJECT_NAME': 'foo'}) self.assertEqual(state.get_context_variable('PROJECT_NAME'), 'foo') self.assertNotEqual(state.get_context_variable('not_created'), 'foo')
def test_update_context_variables(self): state = State() state.update_context_variables([1, 2, 3]) self.mocked_facio_state_State_warning.assert_called_once_with( 'Failed to update context variables with [1, 2, 3]')
def test_get_context_variables(self): state = State() state.update_context_variables({'PROJECT_NAME': 'foo'}) self.assertEqual(state.get_context_variables(), {'PROJECT_NAME': 'foo'})
def test_save_hook_call(self): state = State() state.save_hook_call('foo.bar', 'baz') state.save_hook_call('baz.foo', 'bar') calls = state.save_hook_call('foo.bar', 'baz') self.assertEqual(calls, [('foo.bar', 'baz'), ('baz.foo', 'bar')])
def test_get_hook_call(self): state = State() state.save_hook_call('foo.bar', 'baz') state.save_hook_call('baz.foo', 'bar') self.assertEqual(state.get_hook_call('foo.bar'), 'baz') self.assertEqual(state.get_hook_call('baz.foo'), 'bar')
def test_get_context_variables_empty(self): state = State() self.assertEqual(state.get_context_variables(), {})
def test_return_project_root(self, mock_pwd): state = State() state.set_project_name('foo') self.assertEqual(state.get_project_root(), '/bar/foo')
def test_return_current_working_dir(self, mock_pwd): state = State() state.set_project_name('foo') self.assertEqual(state.get_working_directory(), '/foo')
def test_get_set_project_name(self): state = State() state.set_project_name('foo') self.assertEqual(state.get_project_name(), 'foo')
def test_same_instance_always_returned(self): s1 = State() s2 = State() self.assertEqual(s1.state, s2.state)