Beispiel #1
0
 def it_prints_help_when_there_is_no_data(self, stdout, Data):
     Data.return_value.is_empty.return_value = True
     cli = CLI()
     cli.start([])
     assert "Usage:" in stdout.getvalue()
Beispiel #2
0
 def it_lists_all_keys_when_there_is_data(self, stdout, Data):
     Data.return_value.is_empty.return_value = False
     Data.return_value.list.return_value = {"foo": "bar", "asdf": "fdsa"}
     cli = CLI()
     cli.start([])
     assert " foo: bar\nasdf: fdsa\n" == stdout.getvalue()
Beispiel #3
0
 def it_gets_keys(self, Data):
     cli = CLI()
     cli.start(["foo"])
     Data.return_value.get.assert_called_with("foo")
Beispiel #4
0
 def it_deletes_keys(self, Data):
     cli = CLI()
     cli.start(["-d", "foo"])
     Data.return_value.delete.assert_called_with("foo")
Beispiel #5
0
 def it_lists_all_keys_when_there_is_data(self, stdout, Data):
     Data.return_value.is_empty.return_value = False
     Data.return_value.list.return_value = {'foo': 'bar', 'asdf': 'fdsa'}
     cli = CLI()
     cli.start([])
     assert ' foo: bar\nasdf: fdsa\n' == stdout.getvalue()
Beispiel #6
0
 def it_prints_help_when_there_is_no_data(self, stdout, Data):
     Data.return_value.is_empty.return_value = True
     cli = CLI()
     cli.start([])
     assert "Usage:" in stdout.getvalue()
Beispiel #7
0
 def it_deletes_keys(self, Data):
     cli = CLI()
     cli.start(['-d', 'foo'])
     Data.return_value.delete.assert_called_with('foo')
Beispiel #8
0
 def it_gets_keys(self, Data):
     cli = CLI()
     cli.start(['foo'])
     Data.return_value.get.assert_called_with('foo')
Beispiel #9
0
 def it_has_a_data_attribute(self, Data):
     assert CLI().data is not None