def test_fails_to_post_one(self, content='{"success":true}', content_type=None): httpretty.register_uri( httpretty.POST, self.endpoint_url, status=self.status_code, content_type=(content_type or self.content_type), body=(content or self.content)) self.given_a_file('todo/hello.txt', b'spiffy paloo') exit_code = main([self.dir_path, self.endpoint_url]) self.then_should_post_to_server(b'spiffy paloo') self.then_exit_code_should_denote_error(exit_code) self.then_file_should_be_left_in_todo('hello.txt')
def test_post_one(self): httpretty.register_uri( httpretty.POST, self.endpoint_url, status=self.status_code, content_type=self.content_type, body=self.content) self.given_a_file('todo/hello.txt', b'this is the message content') exit_code = main([self.dir_path, self.endpoint_url]) self.then_should_post_to_server(b'this is the message content') self.then_exit_code_should_denote_success(exit_code) self.then_file_should_be_moved_to_done('hello.txt')