Exemple #1
0
    def test_get_context_variables(self):
        state = State()

        state.update_context_variables({'PROJECT_NAME': 'foo'})

        self.assertEqual(state.get_context_variables(), {
            'PROJECT_NAME': 'foo'})
Exemple #2
0
    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')
Exemple #3
0
    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]')
Exemple #4
0
    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]')
Exemple #5
0
    def test_get_context_variables(self):
        state = State()

        state.update_context_variables({'PROJECT_NAME': 'foo'})

        self.assertEqual(state.get_context_variables(),
                         {'PROJECT_NAME': 'foo'})
Exemple #6
0
    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')])
Exemple #7
0
    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')])
Exemple #8
0
    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')
Exemple #9
0
    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')
Exemple #10
0
    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')
Exemple #11
0
    def test_get_context_variables_empty(self):
        state = State()

        self.assertEqual(state.get_context_variables(), {})
Exemple #12
0
    def test_return_project_root(self, mock_pwd):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_project_root(), '/bar/foo')
Exemple #13
0
    def test_get_context_variables_empty(self):
        state = State()

        self.assertEqual(state.get_context_variables(), {})
Exemple #14
0
    def test_return_project_root(self, mock_pwd):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_project_root(), '/bar/foo')
Exemple #15
0
    def test_return_current_working_dir(self, mock_pwd):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_working_directory(), '/foo')
Exemple #16
0
    def test_get_set_project_name(self):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_project_name(), 'foo')
Exemple #17
0
    def test_return_current_working_dir(self, mock_pwd):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_working_directory(), '/foo')
Exemple #18
0
    def test_same_instance_always_returned(self):
        s1 = State()
        s2 = State()

        self.assertEqual(s1.state, s2.state)
Exemple #19
0
    def test_get_set_project_name(self):
        state = State()
        state.set_project_name('foo')

        self.assertEqual(state.get_project_name(), 'foo')