validictory + JSONSchema.net = Good combination for automated REST API testing

Install the validictory Python module : https://github.com/jamesturk , /validictory/ http://validictory.readthedocs.io

Generate the JSON schema for validation based on the unique JSON from your endpoints : http://jsonschema.net

Compare the schema vs the returned JSON. Sample:

try:
    validictory.validate(json_response_from_endpoint, json_validation_schema)
except ValueError, error:
    print error
    self.fail("that did not work out")

Success.

I’ll add some validictory snippets when I get around to it.

Visual Studio Code is winning me over

Visual Studio Code has all of the features I currently need and it’s fast. It’s becoming my editor of choice. I have used Notepad++, Sublime and Atom in the past. Currently, VS Code is in the lead.

  • fast
  • nice dark theme
  • plenty of extensions
  • easy to configure and run scripts from editor
  • syntax checking, highlighting
  • find and select next instance of text
  • duplicate text/line, move lines, multiple cursors, block edit
  • find/replace with Regex
  • minimap

One thing that I would like is a nice remote editing tool like NppFTP.

Apple Music family account. Only took five days and six hours on the phone to set up.

It should not take five days and multiple calls to support lasting over six hours to set up a family account.

The long/short story : I had one icloud account set up on a Mac. It had my credit card information. My wife had another icould account set up on her iPod (completely normal) but she had a different credit card number entered for purchases. When I created a family account I was able to add all family members through the interface. However, when I joined Apple Music paid membership, only I was able to use the “pro” features. None of my family members were. Support had me jump through all the hoops:

  • reboot
  • restart
  • delete family
  • add family
  • I was told after changing the settings to wait up to 2 days for the change to kick in? That was hilarious.
  • restart iPod, iPad, iPhone, MacBook multiple times
  • log out and log in probably at least sixty times across 5 devices
  • wait, wait, wait on hold and more waiting

Still nothing, Apple music support was clueless. I suggested to them that the issue may be that the credit cards are different for my wife and myself but they blew it off. Finally when I said I would do it myself, they said OK, try it. This worked. I had to change the credit cards to match and only then the entire family was able to use Apple Music. It did not take 2 days for the change to take effect. It was instantaneous. I asked for  a free month of Apple Music for my multi-day trouble and was denied.

The only reason I am using Apple Music is because they have the family explicit filter. I would switch in a heartbeat to any other provider but they lack this simple feature.

Lenovo 110 Dual Boot Windows 10 with Ubuntu 16.10

I had trouble setting up a new Lenovo 110 17ikb to dual boot with Ubuntu on a Windows 10 machine. Here are some steps that I took to resolve this, including the to not so successful ones

  • Started with just an install of Windows 10 on a new 2017 Lenovo 110 17ikb.
  • I first freed up some space on the partition using diskmgmt.msc in Windows. I might have overdone it leaving 250GB.
  • I had an existing Ubuntu bootable USB drive (16.04). Tried using the Windows 10 EFI boot from USB option with that drive (from the Recovery settings screen) but that did not work. System said that it could not find the USB drive on reboot.
  • I then created a new USB ISO image (Ubuntu 16.10) using latest Rufus which should support BIOS and UEFI. Rebooted with USB as boot device but that did not work either. System did not find any bootable USB devices.
  • I then created a new 16.04 USB ISO image (Ubuntu 16.04) using latest Rufus using same process as in previous step. Rebooted with USB as boot device but that did not work as well. System did not find any bootable USB devices.
  • From the BIOS or UEFI settings I switched to Legacy mode and Legacy boot order (something like that). Moved Boot to USB to top in boot order. Now my USB drive was recognized on boot. The problem was that when trying to install Ubuntu it wanted to overwrite the entire drive (not install alongside Windows Boot Manager) so I had to stop this.
  • I was about to give up here …
  • I then tried to boot to an older Linux (FC9 i think) ISO CD that I had from before. Again selected EFI boot from CD/DVD. Again it did not work.
  • I kept at it.
  • I now burned a DVD ISO image (using ImgBurn) of the 16.10 version I downloaded eralier.
  • Selected again to boot from EFI CD/DVD. Restarted PC and to my amazement it worked. It started up booting from the DVD. It booted into Ubuntu. I started the installation and it was successful. I did see the option to install Ubuntu alongside Windows Boot Manager. Now when starting up PC I can see options to boot into Ubuntu or Windows.
  • The only unusual thing while installing Ubuntu was that I was not prompted to choose the free space partition I created in first step to install Ubuntu there. It luckily did install Ubuntu in this free partition. I would readd this step (it was there before) just to make installers a bit more certain that the correct location will be used.
  • That’s it. Took much longer than it should have. Hope it helps someone.

Selenium IDE for presentations? Absolutely!

A few days ago, I had a great idea to use Selenium IDE as automation tool for a brief demo. It would be a quick overview of a new set up in AWS, just to show that it works as well as it does already in other environments. I recorded a quick script in Selenium IDE, set the pause of three to five seconds between actions and timed execution for 90 seconds. It went great. When it was my turn, I hooked up the laptop to the main conference room screen, and started the Selenium IDE script, then minimized the pop up in Firefox. I stood by the screen pointing out the items that were being shown, the pages, clicks, forms populated, the correct URLs and what not. It went great and was perfectly on time. Actually it went so smooth, people though it was not live, but PowerPoint. Also, nothing was missed as the steps were previously though out well.

I think I will use this in future as well.

Canceling Spotify Family Membership due to lack of explicit filter. For now it’s Bye Bye Spotify!

I am canceling our Spotify Family Membership due to lack of explicit filter.

I thought I read somewhere that if one of the family members is under 17 or 18 that it will automatically block the songs marked as Explicit. Boy was I wrong. Luckily I checked our kids accounts and it was all there. Red flag.

Not only is this desired for kids accounts, I personally also do not want to listen to songs (like many others) which have lyrics that are violent, demeaning, have explicit verses and similar.

For now it’s Bye Bye Spotify!

Recommended PyCharm plugin : .ignore. Helps manage .gitignore files!

Once you start working with PyCharm you will notice a bunch of .pyc files everywhere. There is also the .idea folder and other items you might not want checked in to your repository.

.gitignore is useful for specifying these files (in Git). To make managing .gitignore foolproof, plugin called .ignore is most useful. It will add some right click options which will enable you to quickly add any file to be ignored by the versioning system. The plugin also suggests other files to ignore (most helpful) that you might have missed. Get it from your PyCharm Plugins UI.

Copy/Paste from the description:
.ignore (.ignore on GitHub) is a plugin for .gitignore (GIT), .hgignore (Mercurial), .npmignore (NPM), .dockerignore (Docker), .chefignore (Chef), .cvsignore (CVS), .bzrignore (Bazaar), .boringignore (Darcs), .mtn-ignore (Monotone), ignore-glob (Fossil), .jshintignore (JSHint), .tfignore (Team Foundation), .p4ignore (Perforce), .flooignore (Floobits), .eslintignore (ESLint), .cfignore (Cloud Foundry), .jpmignore (Jetpack), .stylelintignore (StyleLint) files in your project. Features:

    Files syntax highlight
    Coloring ignored files in the Project View
    Gitignore templates filtering and selecting in rules generator by name and content
    Show ignored files by specified ignore file (right click on .gitignore file)
    Create file in currently selected directory
    Generate Gitignore rules basing on GitHub’s templates collection
    Add selected file/directory to ignore rules from popup menu
    Suggesting .gitignore file creation for new project
    Entries inspection (duplicated, covered, unused, relative, incorrect syntax, relative entries) with fix actions
    Comments and brackets support
    Navigation to entries in Project view
    Renaming entries from ignore file
    Close opened ignored files action
    Custom user templates with import/export features
    Create custom templates from existing rules
    Favorite templates

When you need to loop instructions with Selenium IDE, Flow Control is your friend

That’s all. You can easily set start and end points, then loop through them. Helped me on several occasions when I needed to quickly get rid of multiple entries in the UI. Recorded the Delete and Confirm Delete actions, then just set to loop. All 418 of them were gone in a few minutes. I did have to set the speed to a slower value, just so it catches the confirm delete modal. Recommended:

Flow Control

Waiting for the loading icon to finish. Selenium Python. “while” helps again.

So many pages now have the “loading ..” icon while waiting for something.
A simple way to wait while it’s done, again with “while” statement:

while self.driver.find_element_by_css_selector("div#loadingIcon").get_attribute("style") == "display: block;":
                time.sleep(0.5)

In this case the div had “display: block;” when visible (when it’s loading) and “display: none;” when it was not loading.