Now we'll flesh out some of our test cases. Our test suite is limited, because I'm hitting the limit of Twitter's requests/15 minute period after about 3 test runs. I wanted to show the types of tests to make, and how the functions might interact with each other.
Monday, August 29, 2016
Sunday, August 28, 2016
Data containers for REST calls and responses.
I would say most people using python probably wouldn't do this, but coming from a c# and java background, it's ingrained in my head to make container classes for data. I think it helps keep track of the data. Admittedly, I've done some tricky things to do to make generic methods to translate the fields into json (or some other payload), and back. But once they are written you don't have to deal with it anymore.
Wednesday, August 24, 2016
Adding a container class for auth credentials.
First we are going add a container class for the service credentials we need to pass around. I would also suppose that if we were going to encrypt these values, that having this container class be the place where the data is encrypted/decrypted makes sense (but we're not doing that right now).
Time to add some data classes, and add more test cases.
I've decided to break up the next bits of work into several blog posts. The posts are described as follows:
So without further ado, here we go...
- Adding a container class for auth credentials
- Adding data classes for twitter update status payload, and responses.
- Adding more test cases.
I have one branch for all these changes:
So without further ado, here we go...
Friday, August 19, 2016
Adding test teardown.
I want to add a teardown method to my tests. We've just been posting tweets, and not cleaning them up! Frankly my reason for doing this is because the return json from getting my account timeline is huge.
Thursday, August 11, 2016
Let's add some logging
It's time we added more tests. To do that we can add a few things. First up on our list of things to do is setting up logging. Logging is very easy to do in Python. Once you configure your log file, any instance of logger you make with the same "logger id" will output to the same file. First we need a log file directory. I'm making mine right in my project. When running tests in a CI system I would probably put them somewhere else. Also make sure the contents of your log directory are excluded from your source control.
For more information about python logging, go here: https://docs.python.org/3/howto/logging.html
For more information about python logging, go here: https://docs.python.org/3/howto/logging.html
Subscribe to:
Comments (Atom)